package com.breadenglish.cms.api.app.gateway.manager;

import com.breadenglish.cms.api.app.gateway.model.Feedback;
import org.jsondoc.core.annotation.*;
import org.jsondoc.core.pojo.ApiStage;
import org.jsondoc.core.pojo.ApiVisibility;
import org.springframework.web.bind.annotation.*;

/**
 * Created by jk on 16/1/6.
 */
@Api(name = "意见反馈", description = "用户提交意见,服务器端接收后发送email给指定账号", group = "客户端接口", visibility = ApiVisibility.PUBLIC, stage = ApiStage.RC)
@ApiVersion(since = "1.0", until = "2.12")
@ApiAuthNone
@RestController
@RequestMapping(value = "/feedback")
public class FeedbackController {
    @ApiMethod
    @RequestMapping(method = RequestMethod.POST)
    public
    @ApiResponseObject
    void submitJsonFeedback(@ApiBodyObject(clazz = Feedback.class) @RequestBody Feedback feedback) {
        System.out.println(feedback.getUserId());
        System.out.println(feedback.getContent());
        System.out.println(feedback.getEmail());
    }

    @ApiMethod
    @RequestMapping(value = "/{userId}", method = RequestMethod.POST)
    public
    @ApiResponseObject
    void submitJsonFeedback(@ApiPathParam(description = "用户ID") @PathVariable(value = "userId") int userId, @ApiBodyObject(clazz = Feedback.class) @RequestBody Feedback feedback) {
        System.out.println(userId);
        System.out.println(feedback.getContent());
        System.out.println(feedback.getEmail());
    }
}
